home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / sun3.md / a.out.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  3.0 KB  |  114 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)a.out.h    5.2 (Berkeley) 4/7/87
  7.  * $Header: /sprite/src/lib/include/sun3.md/RCS/a.out.h,v 1.13 91/11/14 21:39:08 kupfer Exp $ SPRITE (Berkeley)
  8.  */
  9.  
  10. /*
  11.  * Definitions of the a.out header
  12.  * and magic numbers are shared with
  13.  * the kernel.
  14.  */
  15. #ifndef _AOUT
  16. #define _AOUT
  17.  
  18. #include <sun3.md/sys/exec.h>
  19.  
  20. extern int Aout_PageSize[];
  21.  
  22. /*
  23.  * Macro to tell whether or not the magic number in an a.out file
  24.  * is an illegal one.
  25.  */
  26.  
  27. #define    N_BADMAG(x) \
  28.     (((x).a_magic)!=OMAGIC && \
  29.      ((x).a_magic)!=NMAGIC && \
  30.      ((x).a_magic)!=ZMAGIC && \
  31.      ((x).a_magic)!=SPRITE_ZMAGIC && \
  32.      ((x).a_magic)!=UNIX_ZMAGIC)
  33.  
  34. /*
  35.  * Macros to tell where various pieces of information start in the
  36.  * a.out file.
  37.  */
  38.  
  39. #define N_PAGSIZ(x) (Aout_PageSize[(x).a_machtype])
  40.  
  41. #define N_TXTOFF(x) \
  42.     (((x).a_magic==ZMAGIC || (x).a_magic==UNIX_ZMAGIC) \
  43.         ? 0 : sizeof (struct exec))
  44. #define N_SYMOFF(x) \
  45.     (N_TXTOFF(x) + (x).a_text+(x).a_data + (x).a_trsize + (x).a_drsize)
  46. #define    N_STROFF(x) \
  47.     (N_SYMOFF(x) + (x).a_syms)
  48.  
  49. /*
  50.  * Macros to tell where the various segments start in virtual memory,
  51.  * when the process is loaded.
  52.  */
  53. #include <sun3.md/kernel/procMach.h>
  54.  
  55. #define N_TXTADDR(x) PROC_CODE_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  56. #define N_DATADDR(x) PROC_DATA_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  57. #define N_BSSADDR(x) PROC_BSS_LOAD_ADDR(*((ProcExecHeader *) &(x)))
  58.  
  59. /*
  60.  * Format of a relocation datum.
  61.  */
  62. struct relocation_info {
  63.     int    r_address;    /* address which is relocated */
  64. unsigned int    r_symbolnum:24,    /* local symbol ordinal */
  65.         r_pcrel:1,     /* was relocated pc relative already */
  66.         r_length:2,    /* 0=byte, 1=word, 2=long */
  67.         r_extern:1,    /* does not include value of sym referenced */
  68.         :4;        /* nothing, yet */
  69. };
  70.  
  71. /*
  72.  * Format of a symbol table entry; this file is included by <a.out.h>
  73.  * and should be used if you aren't interested the a.out header
  74.  * or relocation information.
  75.  */
  76. struct    nlist {
  77.     union {
  78.         char    *n_name;    /* for use when in-core */
  79.         long    n_strx;        /* index into file string table */
  80.     } n_un;
  81. unsigned char    n_type;        /* type flag, i.e. N_TEXT etc; see below */
  82.     char    n_other;    /* unused */
  83.     short    n_desc;        /* see <stab.h> */
  84. unsigned long    n_value;    /* value of this symbol (or sdb offset) */
  85. };
  86. #define    n_hash    n_desc        /* used internally by ld */
  87.  
  88. /*
  89.  * Simple values for n_type.
  90.  */
  91. #define    N_UNDF    0x0        /* undefined */
  92. #define    N_ABS    0x2        /* absolute */
  93. #define    N_TEXT    0x4        /* text */
  94. #define    N_DATA    0x6        /* data */
  95. #define    N_BSS    0x8        /* bss */
  96. #define    N_COMM    0x12        /* common (internal to ld) */
  97. #define    N_FN    0x1e        /* file name symbol */
  98.  
  99. #define    N_EXT    01        /* external bit, or'ed in */
  100. #define    N_TYPE    0x1e        /* mask for all the type bits */
  101.  
  102. /*
  103.  * Sdb entries have some of the N_STAB bits set.
  104.  * These are given in <stab.h>
  105.  */
  106. #define    N_STAB    0xe0        /* if any of these bits set, a SDB entry */
  107.  
  108. /*
  109.  * Format for namelist values.
  110.  */
  111. #define    N_FORMAT    "%08x"
  112.  
  113. #endif /* _AOUT */
  114.